/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "pytctbactmesp")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pytctbactmesp.findAll", query = "SELECT p FROM Pytctbactmesp p"),
    @NamedQuery(name = "Pytctbactmesp.findByPytctbactmespid", query = "SELECT p FROM Pytctbactmesp p WHERE p.pytctbactmespid = :pytctbactmespid"),
    @NamedQuery(name = "Pytctbactmesp.findByPorcentaje", query = "SELECT p FROM Pytctbactmesp p WHERE p.porcentaje = :porcentaje"),
    @NamedQuery(name = "Pytctbactmesp.findByFecharegistro", query = "SELECT p FROM Pytctbactmesp p WHERE p.fecharegistro = :fecharegistro"),
    @NamedQuery(name = "Pytctbactmesp.findByObservaciones", query = "SELECT p FROM Pytctbactmesp p WHERE p.observaciones = :observaciones"),
    @NamedQuery(name = "Pytctbactmesp.findByNotas", query = "SELECT p FROM Pytctbactmesp p WHERE p.notas = :notas")})
public class Pytctbactmesp implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pytctbactmespid")
    private Integer pytctbactmespid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "porcentaje")
    private double porcentaje;
    @Column(name = "fecharegistro")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecharegistro;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @Size(max = 255)
    @Column(name = "notas")
    private String notas;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pytctbactmespid")
    private Collection<Pytctbactmese> pytctbactmeseCollection;
    @JoinColumn(name = "pytctbactompid", referencedColumnName = "pytctbactcompid")
    @ManyToOne(optional = false)
    private Pytctbactcomp pytctbactompid;
    @JoinColumn(name = "pyfntbmesesid", referencedColumnName = "pyfntbmesesid")
    @ManyToOne(optional = false)
    private Pyfntbmeses pyfntbmesesid;

    public Pytctbactmesp() {
    }

    public Pytctbactmesp(Integer pytctbactmespid) {
        this.pytctbactmespid = pytctbactmespid;
    }

    public Pytctbactmesp(Integer pytctbactmespid, double porcentaje, String observaciones) {
        this.pytctbactmespid = pytctbactmespid;
        this.porcentaje = porcentaje;
        this.observaciones = observaciones;
    }

    public Integer getPytctbactmespid() {
        return pytctbactmespid;
    }

    public void setPytctbactmespid(Integer pytctbactmespid) {
        this.pytctbactmespid = pytctbactmespid;
    }

    public double getPorcentaje() {
        return porcentaje;
    }

    public void setPorcentaje(double porcentaje) {
        this.porcentaje = porcentaje;
    }

    public Date getFecharegistro() {
        return fecharegistro;
    }

    public void setFecharegistro(Date fecharegistro) {
        this.fecharegistro = fecharegistro;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    public String getNotas() {
        return notas;
    }

    public void setNotas(String notas) {
        this.notas = notas;
    }

    @XmlTransient
    public Collection<Pytctbactmese> getPytctbactmeseCollection() {
        return pytctbactmeseCollection;
    }

    public void setPytctbactmeseCollection(Collection<Pytctbactmese> pytctbactmeseCollection) {
        this.pytctbactmeseCollection = pytctbactmeseCollection;
    }

    public Pytctbactcomp getPytctbactompid() {
        return pytctbactompid;
    }

    public void setPytctbactompid(Pytctbactcomp pytctbactompid) {
        this.pytctbactompid = pytctbactompid;
    }

    public Pyfntbmeses getPyfntbmesesid() {
        return pyfntbmesesid;
    }

    public void setPyfntbmesesid(Pyfntbmeses pyfntbmesesid) {
        this.pyfntbmesesid = pyfntbmesesid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pytctbactmespid != null ? pytctbactmespid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pytctbactmesp)) {
            return false;
        }
        Pytctbactmesp other = (Pytctbactmesp) object;
        if ((this.pytctbactmespid == null && other.pytctbactmespid != null) || (this.pytctbactmespid != null && !this.pytctbactmespid.equals(other.pytctbactmespid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Pytctbactmesp[ pytctbactmespid=" + pytctbactmespid + " ]";
    }
    
}
